fix(merge_lora): use CPU-safe precision to avoid false AMP warning - #2322
Open
ShamikOfficial wants to merge 1 commit into
Open
fix(merge_lora): use CPU-safe precision to avoid false AMP warning#2322ShamikOfficial wants to merge 1 commit into
ShamikOfficial wants to merge 1 commit into
Conversation
merge_lora only needs weights and already sets dtype from the LoRA checkpoint, so reusing training precision like 16-mixed on CPU only triggers a misleading Fabric warning. Co-authored-by: Cursor <cursoragent@cursor.com>
ShamikOfficial
requested review from
andyland,
k223kim,
lianakoleva and
t-vi
as code owners
September 7, 2026 03:06
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
closes #1242
merge_loraalways runs Fabric on CPU, but it used to reuse the training precision from hyperparameters (often16-mixed). Fabric then warns that AMP fp16 is unsupported on CPU and switches tobf16-mixed. That warning is misleading here: merge only loads weights and sets dtype from the LoRA checkpoint.This change instantiates Fabric with
32-trueso the warning is not emitted. Merge output is unchanged.Test plan
pytest tests/test_merge_lora.py::test_merge_lora_avoids_16_mixed_cpu_warning tests/test_merge_lora.py::test_merge_lora